package com.ias.train.common;

/**
 * @program: train
 * @description: 异常类
 * @author: Daniel Shen
 * @create: 2022-04-23 15:25
 */
public class MessageException extends RuntimeException {
    private Integer code;
    private String message;
    private Object data;

    public MessageException(MessageStatusCode messageStatusCode) {
        this.code = messageStatusCode.getCode();
        this.message = messageStatusCode.getMessage();
    }

    public MessageException(MessageStatusCode messageStatusCode, String message) {
        this.code = messageStatusCode.getCode();
        this.message = message;
    }

    public MessageException(MessageStatusCode messageStatusCode, Object data) {
        this.code = messageStatusCode.getCode();
        this.message = messageStatusCode.getMessage();
        this.data = data;
    }

    public MessageException(MessageStatusCode messageStatusCode, String message, Object data) {
        this.code = messageStatusCode.getCode();
        this.message = message;
        this.data = data;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public Object getData() {
        return this.data;
    }
}
